﻿#include "SListNode.h"


void SLTNodeText01()
{
	SLTNode* plist = NULL;

	// 测试尾插
	//printf("测试尾插\n");
	//SLTPushBack(&plist, 1);
	//SLTPushBack(&plist, 2);
	//SLTPushBack(&plist, 3);
	//SLTPushBack(&plist, 4);
	//SLTPrint(plist);// 1->2->3->4->NULL;


	// 测试头插
	//printf("测试头插\n");
	SLTPushFront(&plist, 5);
	//SLTPrint(plist);

	SLTPushFront(&plist, 6);
	//SLTPrint(plist);

	SLTPushFront(&plist, 7);
	//SLTPrint(plist);

	SLTPushFront(&plist, 8);
	SLTPrint(plist);


    // 测试尾删
 //   printf("测试尾删除\n");
	//SLTPopBack(&plist);
	//SLTPrint(plist);
	//SLTPopBack(&plist);
	//SLTPrint(plist);
	//SLTPopBack(&plist);
	//SLTPrint(plist);



	//// 测试头删
	// printf("测试头删\n");
	//SLTPopFront(&plist);
	//SLTPrint(plist);
	//SLTPopFront(&plist);
	//SLTPrint(plist);
	//SLTPopFront(&plist);
	//SLTPrint(plist);
	//SLTPopFront(&plist);
	//SLTPrint(plist);
	//// 报错
	//SLTPopFront(&plist);
	//SLTPrint(plist);


	//// 测试查找
	printf("查找5\n");
	SLTNode* find = SLTFind(plist, 5);
	if (find == NULL)
	{
		printf("没有找到!\n");
	}
	else
	{
		printf("找到了!\n");
	}


	//// 测试在pos位置之前插⼊数据
	//SLTNode* find = SLTFind(plist, 1);
	//SLTInsert(&plist, find, 11);
	//SLTPrint(plist);


	//// 测试链表在指定位置之后插⼊数据
	//SLTNode* find = SLTFind(plist, 4);
	//SLTInsertAfter(find, 11);
	//SLTPrint(plist);

	//// 测试删除pos之后的节点
	//SLTNode* find = SLTFind(plist, 1);
	//SLTEraseAfter(find);
	//SLTPrint(plist);

	//// 测试销毁
	//SListDesTroy(&plist);
}

int main()
{
	SLTNodeText01();
	return 0;
}